package com.yycx.module.system.provider.controller;

import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import com.yycx.common.mybatis.model.*;
import java.util.Map;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.bind.annotation.RestController;
import com.yycx.common.springmvc.base.BaseController;
import com.yycx.module.system.client.entity.SysProject;
import com.yycx.module.system.provider.service.SysProjectService;


/**
 * 项目控制器
 *
 * @author flyme
 * @date 2024-07-09
 */
@RestController
@RequestMapping("/system/project/")
@Api(tags = "基础模块-项目管理")
public class SysProjectController extends BaseController<SysProjectService, SysProject>  {

    @ApiOperation(value = "项目-分页列表", notes = "项目分页列表")
    @GetMapping(value = "page")
    public ResultBody pageList(@RequestParam(required = false) Map params) {
        return bizService.pageList(params);
    }

    @ApiOperation(value = "项目-列表", notes = "项目列表")
    @GetMapping(value = "list")
    public ResultBody list(@RequestParam(required = false) Map params) {
        return bizService.listEntityMap(params);
    }

    @ApiOperation(value = "项目-添加", notes = "添加项目")
    @PostMapping(value = "save")
    public ResultBody save(@RequestParam(required = false) Map params) {
        return bizService.add(params);
    }

    @ApiOperation(value = "项目-更新", notes = "更新项目")
    @PostMapping(value = "update")
    public ResultBody update(@RequestParam(required = false) Map params) {
        return bizService.edit(params);
    }

    @ApiOperation(value = "项目-删除", notes = "删除项目")
    @PostMapping(value = "remove")
    public ResultBody remove(@RequestParam(required = false) Map params) {
        return bizService.delete(params);
    }


    @ApiOperation(value = "项目-详情", notes = "项目详情")
    @GetMapping(value = "get")
    public ResultBody get(@RequestParam(required = false) Map params) {
        return bizService.get(params);
    }
    /**
    * 导出项目统计
    *
    * @param params
    * @param request
    * @param response
    */
    @PostMapping(value = "export")
    public void export(@RequestParam(required = false) Map params, HttpServletRequest request, HttpServletResponse response) {
        bizService.export(params, request, response, "项目统计", "项目统计表");
    }

    @PostMapping(value = "setStatus")
    public ResultBody setStatus(@RequestParam(required = false) Map map, @RequestParam(value = "projectState") Integer status) {
        return bizService.setState(map, "projectState", status);
    }

}
